<div id="header">
    <div id="sub_header">
        <div id="menu">
            <ul id="first_menu">
                <li>
                    <?php echo CHtml::link('Trang chủ', array('site/index')) ?>
                </li>
                <li>
                    <?php echo CHtml::link('Liên hệ', array('site/contact')) ?>
                </li>
                <li>
                    <?php echo CHtml::link('Giới thiệu', array('site/aboutus')) ?>
                </li>
                <?php if (Yii::app()->user->isGuest) { ?>
                    <li>
                         <?php echo CHtml::link('Đăng kí', array('site/register')) ?>
                    </li>
            </ul>            
            
            <!--search box
            <search>
                <form action="/search/" method="post">
                    <input style="border:1px solid #ccc;" name="keywords" id="keywords" type="text" size="40" placeholder="Search..." />
                    <input type="submit"class="submit_btn" value="">
                </form>
            </search>
            -->
            
              <?php } ?>
                    
                <?php if (Yii::app()->user->isGuest) { ?>
                <div class = "login">
                    <div class="account_icon"></div>


                    <div class="form">
                        <?php
                        $form = $this->beginWidget('CActiveForm', array(
                            'id' => 'login-form',
                            'action' => array("site/login"),
                            'method' => 'post',
                            'enableClientValidation' => false,
                            'clientOptions' => array(
                            'validateOnSubmit' => true,
                            ),
                                ));
                        ?>
                        <div class ="input-user">
                            <?php echo $form->textField($login_form, 'email'); ?>
                            <?php echo $form->error($login_form, 'email'); ?>
                        </div>

                        <div class ="input-pass">
                            <?php echo $form->passwordField($login_form, 'password'); ?>
                            <?php echo $form->error($login_form, 'password'); ?>
                        </div>
                        <div class="btn-login">
                            <?php echo CHtml::submitButton('Login'); ?>
                        </div>
                     <?php $this->endWidget(); ?>    
                    </div><!-- form -->  
                </div>
            <?php } else { ?>
                <div class="welcome">
                    Welcome <?php echo Yii::app()->user->getFullName(); ?>
                    -
                    <?php if(Yii::app()->user->role == 1){ ?>
                     <?php echo CHtml::link('Vào trang quản trị', array('news/index')) ?>
                    -
                    <?php } ?>
                     <?php echo CHtml::link('Logout', array('site/logout')) ?>
                </div>
            <?php } ?>   
        </div>

    </div>
</div><!--  end header -->

        <div id="second_menu">
        <ul>
            <?php foreach ($categories as $cat): ?>
                <li>
                    
                    <?php echo CHtml::link($cat->category_name, array('categoryDetail/view','id' => $cat->category_id),array('id'=>"xahoi")) ?>
                </li>
            <?php endforeach; ?>
        </ul>
    </div>